﻿#pragma once
#include "DefInfo/def_spell.h"
#include <functional>
#include <vector>
class RoutineAction
{
public:
	RoutineAction();
	~RoutineAction();

	using fun_action_condition = std::function<bool(SpellID)>;

	bool PushSequence(std::string order, SpellID, fun_action_condition);

	bool PushHealSequence(std::string order, SpellID, fun_action_condition);

	void DoAction();

	void DoHealSelfAction();

	void Init();

	struct action_order_condition
	{
		std::string order;
		SpellID spell;
		fun_action_condition fun;
	};
	action_order_condition& GetLastActionOrderCondition();
	action_order_condition& GetActionOrderByOrder(std::string order);
	static void SetConRoSpellID(unsigned int SpellID);
	static void SetConRoSpellPoint(unsigned int* point);
private:
	
	using vec_fun_ac = std::vector<action_order_condition>;
	vec_fun_ac vec_funs_;
	vec_fun_ac vec_heal_self_funs_;
	bool Cast(SpellID spell);
	bool SpellReady(SpellID spell);
	// ConRo
	static unsigned int* ConRoSpellID;
public:
	struct Heal_distance {
		int lost_hp;
		double distance;
	};

	using VecLostHp = std::vector<Heal_distance>;


	std::string ChooseHealTarget(VecLostHp& vec_hps);

	bool ChangeTarget(std::string heal_target);
};

